home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_emacs.idb / usr / freeware / info / emacs-13.z / emacs-13 (.txt)
GNU Info File  |  1998-10-27  |  49KB  |  906 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3. File: emacs,  Node: Select Tags Table,  Next: Find Tag,  Prev: Create Tags Table,  Up: Tags
  4. Selecting a Tags Table
  5. ----------------------
  6.    Emacs has at any time one "selected" tags table, and all the commands
  7. for working with tags tables use the selected one.  To select a tags
  8. table, type `M-x visit-tags-table', which reads the tags table file
  9. name as an argument.  The name `TAGS' in the default directory is used
  10. as the default file name.
  11.    All this command does is store the file name in the variable
  12. `tags-file-name'.  Emacs does not actually read in the tags table
  13. contents until you try to use them.  Setting this variable yourself is
  14. just as good as using `visit-tags-table'.  The variable's initial value
  15. is `nil'; that value tells all the commands for working with tags tables
  16. that they must ask for a tags table file name to use.
  17.    Using `visit-tags-table' when a tags table is already loaded gives
  18. you a choice: you can add the new tags table to the current list of
  19. tags tables, or start a new list.  The tags commands use all the tags
  20. tables in the current list.  If you start a new list, the new tags table
  21. is used *instead* of others.  If you add the new table to the current
  22. list, it is used *as well as* the others.  When the tags commands scan
  23. the list of tags tables, they don't always start at the beginning of
  24. the list; they start with the first tags table (if any) that describes
  25. the current file, proceed from there to the end of the list, and then
  26. scan from the beginning of the list until they have covered all the
  27. tables in the list.
  28.    You can specify a precise list of tags tables by setting the variable
  29. `tags-table-list' to a list of strings, like this:
  30.      (setq tags-table-list
  31.            '("~/emacs" "/usr/local/lib/emacs/src"))
  32. This tells the tags commands to look at the `TAGS' files in your
  33. `~/emacs' directory and in the `/usr/local/lib/emacs/src' directory.
  34. The order depends on which file you are in and which tags table
  35. mentions that file, as explained above.
  36.    Do not set both `tags-file-name' and `tags-table-list'.
  37. File: emacs,  Node: Find Tag,  Next: Tags Search,  Prev: Select Tags Table,  Up: Tags
  38. Finding a Tag
  39. -------------
  40.    The most important thing that a tags table enables you to do is to
  41. find the definition of a specific tag.
  42. `M-. TAG RET'
  43.      Find first definition of TAG (`find-tag').
  44. `C-u M-.'
  45.      Find next alternate definition of last tag specified.
  46. `C-u - M-.'
  47.      Go back to previous tag found.
  48. `C-M-. PATTERN RET'
  49.      Find a tag whose name matches PATTERN (`find-tag-regexp').
  50. `C-u C-M-.'
  51.      Find the next tag whose name matches the last pattern used.
  52. `C-x 4 . TAG RET'
  53.      Find first definition of TAG, but display it in another window
  54.      (`find-tag-other-window').
  55. `C-x 5 . TAG RET'
  56.      Find first definition of TAG, and create a new frame to select the
  57.      buffer (`find-tag-other-frame').
  58.    `M-.' (`find-tag') is the command to find the definition of a
  59. specified tag.  It searches through the tags table for that tag, as a
  60. string, and then uses the tags table info to determine the file that the
  61. definition is in and the approximate character position in the file of
  62. the definition.  Then `find-tag' visits that file, moves point to the
  63. approximate character position, and searches ever-increasing distances
  64. away to find the tag definition.
  65.    If an empty argument is given (just type RET), the sexp in the
  66. buffer before or around point is used as the TAG argument.  *Note
  67. Lists::, for info on sexps.
  68.    You don't need to give `M-.' the full name of the tag; a part will
  69. do.  This is because `M-.' finds tags in the table which contain TAG as
  70. a substring.  However, it prefers an exact match to a substring match.
  71. To find other tags that match the same substring, give `find-tag' a
  72. numeric argument, as in `C-u M-.'; this does not read a tag name, but
  73. continues searching the tags table's text for another tag containing
  74. the same substring last used.  If you have a real META key, `M-0 M-.'
  75. is an easier alternative to `C-u M-.'.
  76.    Like most commands that can switch buffers, `find-tag' has a variant
  77. that displays the new buffer in another window, and one that makes a
  78. new frame for it.  The former is `C-x 4 .', which invokes the command
  79. `find-tag-other-window'.  The latter is `C-x 5 .', which invokes
  80. `find-tag-other-frame'.
  81.    To move back to places you've found tags recently, use `C-u - M-.';
  82. more generally, `M-.' with a negative numeric argument.  This command
  83. can take you to another buffer.  `C-x 4 .' with a negative argument
  84. finds the previous tag location in another window.
  85.    The command `C-M-.' (`find-tag-regexp') visits the tags that match a
  86. specified regular expression.  It is just like `M-.'  except that it
  87. does regexp matching instead of substring matching.
  88. File: emacs,  Node: Tags Search,  Next: List Tags,  Prev: Find Tag,  Up: Tags
  89. Searching and Replacing with Tags Tables
  90. ----------------------------------------
  91.    The commands in this section visit and search all the files listed
  92. in the selected tags table, one by one.  For these commands, the tags
  93. table serves only to specify a sequence of files to search.
  94. `M-x tags-search RET REGEXP RET'
  95.      Search for REGEXP through the files in the selected tags table.
  96. `M-x tags-query-replace RET REGEXP RET REPLACEMENT RET'
  97.      Perform a `query-replace-regexp' on each file in the selected tags
  98.      table.
  99. `M-,'
  100.      Restart one of the commands above, from the current location of
  101.      point (`tags-loop-continue').
  102.    `M-x tags-search' reads a regexp using the minibuffer, then searches
  103. for matches in all the files in the selected tags table, one file at a
  104. time.  It displays the name of the file being searched so you can
  105. follow its progress.  As soon as it finds an occurrence, `tags-search'
  106. returns.
  107.    Having found one match, you probably want to find all the rest.  To
  108. find one more match, type `M-,' (`tags-loop-continue') to resume the
  109. `tags-search'.  This searches the rest of the current buffer, followed
  110. by the remaining files of the tags table.
  111.    `M-x tags-query-replace' performs a single `query-replace-regexp'
  112. through all the files in the tags table.  It reads a regexp to search
  113. for and a string to replace with, just like ordinary `M-x
  114. query-replace-regexp'.  It searches much like `M-x tags-search', but
  115. repeatedly, processing matches according to your input.  *Note
  116. Replace::, for more information on query replace.
  117.    It is possible to get through all the files in the tags table with a
  118. single invocation of `M-x tags-query-replace'.  But often it is useful
  119. to exit temporarily, which you can do with any input event that has no
  120. special query replace meaning.  You can resume the query replace
  121. subsequently by typing `M-,'; this command resumes the last tags search
  122. or replace command that you did.
  123.    The commands in this section carry out much broader searches than the
  124. `find-tag' family.  The `find-tag' commands search only for definitions
  125. of tags that match your substring or regexp.  The commands
  126. `tags-search' and `tags-query-replace' find every occurrence of the
  127. regexp, as ordinary search commands and replace commands do in the
  128. current buffer.
  129.    These commands create buffers only temporarily for the files that
  130. they have to search (those which are not already visited in Emacs
  131. buffers).  Buffers in which no match is found are quickly killed; the
  132. others continue to exist.
  133.    It may have struck you that `tags-search' is a lot like `grep'.  You
  134. can also run `grep' itself as an inferior of Emacs and have Emacs show
  135. you the matching lines one by one.  This works much like running a
  136. compilation; finding the source locations of the `grep' matches works
  137. like finding the compilation errors.  *Note Compilation::.
  138. File: emacs,  Node: List Tags,  Prev: Tags Search,  Up: Tags
  139. Tags Table Inquiries
  140. --------------------
  141. `M-x list-tags RET FILE RET'
  142.      Display a list of the tags defined in the program file `file'.
  143. `M-x tags-apropos RET REGEXP RET'
  144.      Display a list of all tags matching REGEXP.
  145.    `M-x list-tags' reads the name of one of the files described by the
  146. selected tags table, and displays a list of all the tags defined in
  147. that file.  The "file name" argument is really just a string to compare
  148. against the file names recorded in the tags table; it is read as a
  149. string rather than as a file name.  Therefore, completion and
  150. defaulting are not available, and you must enter the file name the same
  151. way it appears in the tags table.  Do not include a directory as part of
  152. the file name unless the file name recorded in the tags table includes a
  153. directory.
  154.    `M-x tags-apropos' is like `apropos' for tags (*note Apropos::.).
  155. It reads a regexp, then finds all the tags in the selected tags table
  156. whose entries match that regexp, and displays the tag names found.
  157.    You can also perform completion in the buffer on the name space of
  158. tag names in the current tags tables.  *Note Symbol Completion::.
  159. File: emacs,  Node: Emerge,  Next: C Mode,  Prev: Tags,  Up: Programs
  160. Merging Files with Emerge
  161. =========================
  162.    It's not unusual for programmers to get their signals crossed and
  163. modify the same program in two different directions.  To recover from
  164. this confusion, you need to merge the two versions.  Emerge makes this
  165. easier.  See also *Note Comparing Files::.
  166. * Menu:
  167. * Overview of Emerge::        How to start Emerge.  Basic concepts.
  168. * Submodes of Emerge::      Fast mode vs. Edit mode.
  169.                   Skip Prefers mode and Auto Advance mode.
  170. * State of Difference::        You do the merge by specifying state A or B
  171.                   for each difference.
  172. * Merge Commands::        Commands for selecting a difference,
  173.                   changing states of differences, etc.
  174. * Exiting Emerge::        What to do when you've finished the merge.
  175. * Combining in Emerge::        How to keep both alternatives for a difference.
  176. * Fine Points of Emerge::   Misc.
  177. File: emacs,  Node: Overview of Emerge,  Next: Submodes of Emerge,  Up: Emerge
  178. Overview of Emerge
  179. ------------------
  180.    To start Emerge, run one of these four commands:
  181. `M-x emerge-files'
  182.      Merge two specified files.
  183. `M-x emerge-files-with-ancestor'
  184.      Merge two specified files, with reference to a common ancestor.
  185. `M-x emerge-buffers'
  186.      Merge two buffers.
  187. `M-x emerge-buffers-with-ancestor'
  188.      Merge two buffers with reference to a common ancestor in a third
  189.      buffer.
  190.    The Emerge commands compare two files or buffers, and display the
  191. comparison in three buffers: one for each input text (the "A buffer"
  192. and the "B buffer"), and one (the "merge buffer") where merging takes
  193. place.  The merge buffer shows the full merged text, not just the
  194. differences.  Wherever the two input texts differ, you can choose which
  195. one of them to include in the merge buffer.
  196.    The Emerge commands that take input from existing buffers use only
  197. the accessible portions of those buffers, if they are narrowed (*note
  198. Narrowing::.).
  199.    If a common ancestor version is available, from which the two texts
  200. to be merged were both derived, Emerge can use it to guess which
  201. alternative is right.  Wherever one current version agrees with the
  202. ancestor, Emerge presumes that the other current version is a deliberate
  203. change which should be kept in the merged version.  Use the
  204. `with-ancestor' commands if you want to specify a common ancestor text.
  205. These commands read three file or buffer names--variant A, variant B,
  206. and the common ancestor.
  207.    After the comparison is done and the buffers are prepared, the
  208. interactive merging starts.  You control the merging by typing special
  209. "merge commands" in the merge buffer.  The merge buffer shows you a
  210. full merged text, not just differences.  For each run of differences
  211. between the input texts, you can choose which one of them to keep, or
  212. edit them both together.
  213.    The merge buffer uses a special major mode, Emerge mode, with
  214. commands for making these choices.  But you can also edit the buffer
  215. with ordinary Emacs commands.
  216.    At any given time, the attention of Emerge is focused on one
  217. particular difference, called the "selected" difference.  This
  218. difference is marked off in the three buffers like this:
  219.      vvvvvvvvvvvvvvvvvvvv
  220.      TEXT THAT DIFFERS
  221.      ^^^^^^^^^^^^^^^^^^^^
  222. Emerge numbers all the differences sequentially and the mode line
  223. always shows the number of the selected difference.
  224.    Normally, the merge buffer starts out with the A version of the text.
  225. But when the A version of a difference agrees with the common ancestor,
  226. then the B version is initially preferred for that difference.
  227.    Emerge leaves the merged text in the merge buffer when you exit.  At
  228. that point, you can save it in a file with `C-x C-w'.  If you give a
  229. numeric argument to `emerge-files' or `emerge-files-with-ancestor', it
  230. reads the name of the output file using the minibuffer.  (This is the
  231. last file name those commands read.) Then exiting from Emerge saves the
  232. merged text in the output file.
  233.    Normally, Emerge commands save the output buffer in its file when you
  234. exit.  If you abort Emerge with `C-]', the Emerge command does not save
  235. the output buffer, but you can save it yourself if you wish.
  236. File: emacs,  Node: Submodes of Emerge,  Next: State of Difference,  Prev: Overview of Emerge,  Up: Emerge
  237. Submodes of Emerge
  238. ------------------
  239.    You can choose between two modes for giving merge commands: Fast mode
  240. and Edit mode.  In Fast mode, basic merge commands are single
  241. characters, but ordinary Emacs commands are disabled.  This is
  242. convenient if you use only merge commands.  In Edit mode, all merge
  243. commands start with the prefix key `C-c C-c', and the normal Emacs
  244. commands are also available.  This allows editing the merge buffer, but
  245. slows down Emerge operations.
  246.    Use `e' to switch to Edit mode, and `C-c C-c f' to switch to Fast
  247. mode.  The mode line indicates Edit and Fast modes with `E' and `F'.
  248.    Emerge has two additional submodes that affect how particular merge
  249. commands work: Auto Advance mode and Skip Prefers mode.
  250.    If Auto Advance mode is in effect, the `a' and `b' commands advance
  251. to the next difference.  This lets you go through the merge faster as
  252. long as you simply choose one of the alternatives from the input.  The
  253. mode line indicates Auto Advance mode with `A'.
  254.    If Skip Prefers mode is in effect, the `n' and `p' commands skip
  255. over differences in states prefer-A and prefer-B (*note State of
  256. Difference::.).  Thus you see only differences for which neither version
  257. is presumed "correct".  The mode line indicates Skip Prefers mode with
  258.    Use the command `s a' (`emerge-auto-advance-mode') to set or clear
  259. Auto Advance mode.  Use `s s' (`emerge-skip-prefers-mode') to set or
  260. clear Skip Prefers mode.  These commands turn on the mode with a
  261. positive argument, turns it off with a negative or zero argument, and
  262. toggle the mode with no argument.
  263. File: emacs,  Node: State of Difference,  Next: Merge Commands,  Prev: Submodes of Emerge,  Up: Emerge
  264. State of a Difference
  265. ---------------------
  266.    In the merge buffer, a difference is marked with lines of `v' and
  267. `^' characters.  Each difference has one of these seven states:
  268.      The difference is showing the A version.  The `a' command always
  269.      produces this state; the mode line indicates it with `A'.
  270.      The difference is showing the B version.  The `b' command always
  271.      produces this state; the mode line indicates it with `B'.
  272. default-A
  273. default-B
  274.      The difference is showing the A or the B state by default, because
  275.      you haven't made a choice.  All differences start in the default-A
  276.      state (and thus the merge buffer is a copy of the A buffer),
  277.      except those for which one alternative is "preferred" (see below).
  278.      When you select a difference, its state changes from default-A or
  279.      default-B to plain A or B.  Thus, the selected difference never has
  280.      state default-A or default-B, and these states are never displayed
  281.      in the mode line.
  282.      The command `d a' chooses default-A as the default state, and `d
  283.      b' chooses default-B.  This chosen default applies to all
  284.      differences which you haven't ever selected and for which no
  285.      alternative is preferred.  If you are moving through the merge
  286.      sequentially, the differences you haven't selected are those
  287.      following the selected one.  Thus, while moving sequentially, you
  288.      can effectively make the A version the default for some sections
  289.      of the merge buffer and the B version the default for others by
  290.      using `d a' and `d b' between sections.
  291. prefer-A
  292. prefer-B
  293.      The difference is showing the A or B state because it is
  294.      "preferred".  This means that you haven't made an explicit choice,
  295.      but one alternative seems likely to be right because the other
  296.      alternative agrees with the common ancestor.  Thus, where the A
  297.      buffer agrees with the common ancestor, the B version is
  298.      preferred, because chances are it is the one that was actually
  299.      changed.
  300.      These two states are displayed in the mode line as `A*' and `B*'.
  301. combined
  302.      The difference is showing a combination of the A and B states, as a
  303.      result of the `x c' or `x C' commands.
  304.      Once a difference is in this state, the `a' and `b' commands don't
  305.      do anything to it unless you give them a numeric argument.
  306.      The mode line displays this state as `comb'.
  307. File: emacs,  Node: Merge Commands,  Next: Exiting Emerge,  Prev: State of Difference,  Up: Emerge
  308. Merge Commands
  309. --------------
  310.    Here are the Merge commands for Fast mode; in Edit mode, precede them
  311. with `C-c C-c':
  312.      Select the previous difference.
  313.      Select the next difference.
  314.      Choose the A version of this difference.
  315.      Choose the B version of this difference.
  316. `C-u N j'
  317.      Select difference number N.
  318.      Select the difference containing point.  You can use this command
  319.      in the merge buffer or in the A or B buffer.
  320.      Quit--finish the merge.
  321. `C-]'
  322.      Abort--exit merging and do not save the output.
  323.      Go into Fast mode.  (In Edit mode, this is actually `C-c C-c f'.)
  324.      Go into Edit mode.
  325.      Recenter (like `C-l') all three windows.
  326.      Specify part of a prefix numeric argument.
  327. `DIGIT'
  328.      Also specify part of a prefix numeric argument.
  329. `d a'
  330.      Choose the A version as the default from here down in the merge
  331.      buffer.
  332. `d b'
  333.      Choose the B version as the default from here down in the merge
  334.      buffer.
  335. `c a'
  336.      Copy the A version of this difference into the kill ring.
  337. `c b'
  338.      Copy the B version of this difference into the kill ring.
  339. `i a'
  340.      Insert the A version of this difference at point.
  341. `i b'
  342.      Insert the B version of this difference at point.
  343.      Put point and mark around the difference.
  344.      Scroll all three windows down (like `M-v').
  345.      Scroll all three windows up (like `C-v').
  346.      Scroll all three windows left (like `C-x <').
  347.      Scroll all three windows right (like `C-x >').
  348.      Reset horizontal scroll on all three windows.
  349. `x 1'
  350.      Shrink the merge window to one line.  (Use `C-u l' to restore it
  351.      to full size.)
  352. `x c'
  353.      Combine the two versions of this difference (*note Combining in
  354.      Emerge::.).
  355. `x f'
  356.      Show the names of the files/buffers Emerge is operating on, in a
  357.      Help window.  (Use `C-u l' to restore windows.)
  358. `x j'
  359.      Join this difference with the following one.  (`C-u x j' joins
  360.      this difference with the previous one.)
  361. `x s'
  362.      Split this difference into two differences.  Before you use this
  363.      command, position point in each of the three buffers at the place
  364.      where you want to split the difference.
  365. `x t'
  366.      Trim identical lines off top and bottom of the difference.  Such
  367.      lines occur when the A and B versions are identical but differ
  368.      from the ancestor version.
  369. File: emacs,  Node: Exiting Emerge,  Next: Combining in Emerge,  Prev: Merge Commands,  Up: Emerge
  370. Exiting Emerge
  371. --------------
  372.    The `q' command (`emerge-quit') finishes the merge, storing the
  373. results into the output file if you specified one.  It restores the A
  374. and B buffers to their proper contents, or kills them if they were
  375. created by Emerge and you haven't changed them.  It also disables the
  376. Emerge commands in the merge buffer, since executing them later could
  377. damage the contents of the various buffers.
  378.    `C-]' aborts the merge.  This means exiting without writing the
  379. output file.  If you didn't specify an output file, then there is no
  380. real difference between aborting and finishing the merge.
  381.    If the Emerge command was called from another Lisp program, then its
  382. return value is `t' for successful completion, or `nil' if you abort.
  383. File: emacs,  Node: Combining in Emerge,  Next: Fine Points of Emerge,  Prev: Exiting Emerge,  Up: Emerge
  384. Combining the Two Versions
  385. --------------------------
  386.    Sometimes you want to keep *both* alternatives for a particular
  387. difference.  To do this, use `x c', which edits the merge buffer like
  388. this:
  389.      #ifdef NEW
  390.      VERSION FROM A BUFFER
  391.      #else /* NEW */
  392.      VERSION FROM B BUFFER
  393.      #endif /* NEW */
  394. While this example shows C preprocessor conditionals delimiting the two
  395. alternative versions, you can specify the strings to use by setting the
  396. variable `emerge-combine-versions-template' to a string of your choice.
  397. In the string, `%a' says where to put version A, and `%b' says where
  398. to put version B.  The default setting, which produces the results
  399. shown above, looks like this:
  400.      "#ifdef NEW\n%a#else /* NEW */\n%b#endif /* NEW */\n"
  401. File: emacs,  Node: Fine Points of Emerge,  Prev: Combining in Emerge,  Up: Emerge
  402. Fine Points of Emerge
  403. ---------------------
  404.    During the merge, you mustn't try to edit the A and B buffers
  405. yourself.  Emerge modifies them temporarily, but ultimately puts them
  406. back the way they were.
  407.    You can have any number of merges going at once--just don't use any
  408. one buffer as input to more than one merge at once, since the temporary
  409. changes made in these buffers would get in each other's way.
  410.    Starting Emerge can take a long time because it needs to compare the
  411. files fully.  Emacs can't do anything else until `diff' finishes.
  412. Perhaps in the future someone will change Emerge to do the comparison in
  413. the background when the input files are large--then you could keep on
  414. doing other things with Emacs until Emerge is ready to accept commands.
  415.    After setting up the merge, Emerge runs the hook
  416. `emerge-startup-hook' (*note Hooks::.).
  417. File: emacs,  Node: C Mode,  Next: Fortran,  Prev: Emerge,  Up: Programs
  418. C Mode
  419. ======
  420.    This section describes special features available in C, C++,
  421. Objective-C and Java modes.
  422. * Menu:
  423. * Motion in C::
  424. * Electric C::
  425. * Hungry Delete::
  426. * Other C Commands::
  427. * Comments in C::
  428. File: emacs,  Node: Motion in C,  Next: Electric C,  Up: C Mode
  429. C Mode Motion Commands
  430. ----------------------
  431.    This section commands for moving point, in C mode and related modes.
  432. `C-c C-u'
  433.      Move point back to the containing preprocessor conditional,
  434.      leaving the mark behind.  A prefix argument acts as a repeat
  435.      count.  With a negative argument, move point forward to the end of
  436.      the containing preprocessor conditional.  When going backwards,
  437.      `#elif' is treated like `#else' followed by `#if'.  When going
  438.      forwards, `#elif' is ignored.
  439. `C-c C-p'
  440.      Move point back over a preprocessor conditional, leaving the mark
  441.      behind.  A prefix argument acts as a repeat count.  With a negative
  442.      argument, move forward.
  443. `C-c C-n'
  444.      Move point forward across a preprocessor conditional, leaving the
  445.      mark behind.  A prefix argument acts as a repeat count.  With a
  446.      negative argument, move backward.
  447. `M-a'
  448.      Move point to the beginning of the innermost C statement.  If
  449.      point is already at the beginning of a statement, move to the
  450.      beginning of the preceding statement.  With prefix argument N,
  451.      move back N - 1 statements.
  452.      If point is within a string or comment, or next to a comment (only
  453.      whitespace between them), this command moves by sentences instead
  454.      of statements.
  455.      When called from a program, this function takes two optional
  456.      arguments: the numeric prefix argument, and a buffer position
  457.      limit (don't move back before that place).
  458. `M-e'
  459.      Move point to the end of the innermost C statement.  If point is
  460.      at the end of a statement, move to the end of the next statement.
  461.      With prefix argument N, move forward N - 1 statements.
  462.      If point is within a string or comment, or next to a comment (only
  463.      whitespace between them), this command moves by sentences instead
  464.      of statements.
  465.      When called from a program, this function takes two optional
  466.      arguments: the numeric prefix argument, and a buffer position
  467.      limit (don't move past that place).
  468. `M-x c-backward-into-nomenclature'
  469.      Move point backward to beginning of a C++ nomenclature section or
  470.      word.  With prefix argument N, move N times.  If N is negative,
  471.      move forward.  C++ nomenclature means a symbol name in the style
  472.      of NamingSymbolsWithMixedCaseAndNoUnderlines; each capital letter
  473.      begins a section or word.
  474.      In the GNU project, we recommend using underscores to separate
  475.      words within an identifier in C or C++, rather than using case
  476.      distinctions.
  477. `M-x c-forward-into-nomenclature'
  478.      Move point forward to end of a C++ nomenclature section or word.
  479.      With prefix argument N, move N times.
  480. File: emacs,  Node: Electric C,  Next: Hungry Delete,  Prev: Motion in C,  Up: C Mode
  481. Electric C Characters
  482. ---------------------
  483.    In C mode and related modes, certain printing characters are
  484. "electric"--in addition to inserting themselves, they also reindent the
  485. current line and may insert newlines.  This feature is controlled by
  486. the variable `c-auto-newline'.  The "electric" characters are `{', `}',
  487. `:', `#', `;', `,', `<', `>', `/' and `*'.
  488.    Electric characters insert newlines only when the "auto-newline"
  489. feature is enabled (indicated by `/a' in the mode line after the mode
  490. name).  This feature is controlled by the variable `c-auto-newline'.
  491. You can turn this feature on or off with the command `C-c C-a':
  492. `C-c C-a'
  493.      Toggle the auto-newline feature (`c-toggle-auto-state').  With a
  494.      prefix argument, this command turns the auto-newline feature on if
  495.      the argument is positive, and off if it is negative.
  496.    The colon character is electric because that is appropriate for a
  497. single colon.  But when you want to insert a double colon in C++, the
  498. electric behavior of colon is inconvenient.  You can insert a double
  499. colon with no reindentation or newlines by typing `C-c :':
  500. `C-c :'
  501.      Insert a double colon scope operator at point, without reindenting
  502.      the line or adding any newlines (`c-scope-operator').
  503.    The electric `#' key reindents the line if it appears to be the
  504. beginning of a preprocessor directive.  This happens when the value of
  505. `c-electric-pound-behavior' is `(alignleft)'.  You can turn this
  506. feature off by setting `c-electric-pound-behavior' to `nil'.
  507.    The variable `c-hanging-braces-alist' controls the insertion of
  508. newlines before and after inserted braces.  It is an association list
  509. with elements of the following form: `(SYNTACTIC-SYMBOL . NL-LIST)'.
  510. Most of the syntactic symbols that appear in `c-offsets-alist' are
  511. meaningful here as well.
  512.    The list NL-LIST may contain either of the symbols `before' or
  513. `after', or both; or it may be `nil'.  When a brace is inserted, the
  514. syntactic context it defines is looked up in `c-hanging-braces-alist';
  515. if it is found, the NL-LIST is used to determine where newlines are
  516. inserted: either before the brace, after, or both.  If not found, the
  517. default is to insert a newline both before and after braces.
  518.    The variable `c-hanging-colons-alist' controls the insertion of
  519. newlines before and after inserted colons.  It is an association list
  520. with elements of the following form: `(SYNTACTIC-SYMBOL . NL-LIST)'.
  521. The list NL-LIST may contain either of the symbols `before' or `after',
  522. or both; or it may be `nil'.
  523.    When a colon is inserted, the syntactic symbol it defines is looked
  524. up in this list, and if found, the NL-LIST is used to determine where
  525. newlines are inserted: either before the brace, after, or both.  If the
  526. syntactic symbol is not found in this list, no newlines are inserted.
  527.    Electric characters can also delete newlines automatically when the
  528. auto-newline feature is enabled.  This feature makes auto-newline more
  529. acceptable, by deleting the newlines in the most common cases where you
  530. do not want them.  Emacs can recognize several cases in which deleting a
  531. newline might be desirable; by setting the variable `c-cleanup-list',
  532. you can specify *which* of these cases that should happen.  The
  533. variable's value is a list of symbols, each describing one case for
  534. possible deletion of a newline.  Here are the meaningful symbols, and
  535. their meanings:
  536. `brace-else-brace'
  537.      Clean up `} else {' constructs by placing entire construct on a
  538.      single line.  The clean-up occurs when you type the `{' after the
  539.      `else', but only if there is nothing but white space between the
  540.      braces and the `else'.
  541. `empty-defun-braces'
  542.      Clean up empty defun braces by placing the braces on the same
  543.      line.  Clean-up occurs when you type the closing brace.
  544. `defun-close-semi'
  545.      Clean up the semicolon after a `struct' or similar type
  546.      declaration, by placing the semicolon on the same line as the
  547.      closing brace.  Clean-up occurs when you type the semicolon.
  548. `list-close-comma'
  549.      Clean up commas following braces in array and aggregate
  550.      initializers.  Clean-up occurs when you type the comma.
  551. `scope-operator'
  552.      Clean up double colons which may designate a C++ scope operator, by
  553.      placing the colons together.  Clean-up occurs when you type the
  554.      second colon, but only when the two colons are separated by
  555.      nothing but whitespace.
  556. File: emacs,  Node: Hungry Delete,  Next: Other C Commands,  Prev: Electric C,  Up: C Mode
  557. Hungry Delete Feature in C
  558. --------------------------
  559.    When the "hungry-delete" feature is enabled (indicated by `/h' or
  560. `/ah' in the mode line after the mode name), a single DEL command
  561. deletes all preceding whitespace, not just one space.  To turn this
  562. feature on or off, use `C-c C-d':
  563. `C-c C-d'
  564.      Toggle the hungry-delete feature (`c-toggle-hungry-state').  With a
  565.      prefix argument, this command turns the hungry-delete feature on
  566.      if the argument is positive, and off if it is negative.
  567. `C-c C-t'
  568.      Toggle the auto-newline and hungry-delete features, both at once
  569.      (`c-toggle-auto-hungry-state').
  570.    The variable `c-hungry-delete-key' controls whether the
  571. hungry-delete feature is enabled.
  572. File: emacs,  Node: Other C Commands,  Next: Comments in C,  Prev: Hungry Delete,  Up: C Mode
  573. Other Commands for C Mode
  574. -------------------------
  575. `C-M-h'
  576.      Put mark at the end of a function definition, and put point at the
  577.      beginning (`c-mark-function').
  578. `M-q'
  579.      Fill a paragraph, handling C and C++ comments (`c-fill-paragraph').
  580.      If any part of the current line is a comment or within a comment,
  581.      this command fills the comment or the paragraph of it that point
  582.      is in, preserving the comment indentation and comment delimiters.
  583. `C-c C-e'
  584.      Run the C preprocessor on the text in the region, and show the
  585.      result, which includes the expansion of all the macro calls
  586.      (`c-macro-expand').  The buffer text before the region is also
  587.      included in preprocessing, for the sake of macros defined there,
  588.      but the output from this part isn't shown.
  589.      When you are debugging C code that uses macros, sometimes it is
  590.      hard to figure out precisely how the macros expand.  With this
  591.      command, you don't have to figure it out; you can see the
  592.      expansions.
  593. `C-c C-\'
  594.      Insert or align `\' characters at the ends of the lines of the
  595.      region (`c-backslash-region').  This is useful after writing or
  596.      editing a C macro definition.
  597.      If a line already ends in `\', this command adjusts the amount of
  598.      whitespace before it.  Otherwise, it inserts a new `\'.  However,
  599.      the last line in the region is treated specially; no `\' is
  600.      inserted on that line, and any `\' there is deleted.
  601. `M-x cpp-highlight-buffer'
  602.      Highlight parts of the text according to its preprocessor
  603.      conditionals.  This command displays another buffer named `*CPP
  604.      Edit*', which serves as a graphic menu for selecting how to
  605.      display particular kinds of conditionals and their contents.
  606.      After changing various settings, click on `[A]pply these settings'
  607.      (or go to that buffer and type `a') to rehighlight the C mode
  608.      buffer accordingly.
  609. `C-c C-s'
  610.      Display the syntactic information about the current source line
  611.      (`c-show-syntactic-information').  This is the information that
  612.      directs how the line is indented.
  613. File: emacs,  Node: Comments in C,  Prev: Other C Commands,  Up: C Mode
  614. Comments in C Modes
  615. -------------------
  616.    C mode and related modes use a number of variables for controlling
  617. comment format.
  618. `c-block-comments-indent-p'
  619.      This variable specifies how to reindent block comments.  The C
  620.      modes support five styles of block comments:
  621.            style 1:    style 2 (GNU):   style 3:    style 4:    style 5:
  622.            /*          /* Blah          /*          /*          /*
  623.               blah        blah.  */      * blah     ** blah     blah
  624.               blah                       * blah     ** blah     blah
  625.               */                         */         */          */
  626.      For the styles 1 through 4, `c-block-comments-indent-p' should be
  627.      `nil' (the default).  If you want to use style 5, set
  628.      `c-block-comments-indent-p' to `t'.
  629.      This variable has no effect on the indentation of the comment-start
  630.      itself or on insertion of asterisks when auto-filling C comments.
  631.      It does not affect `M-q' either.
  632. `c-comment-only-line-offset'
  633.      Extra offset for line which contains only the start of a comment.
  634.      It can be either an integer or a cons cell of the form
  635.      `(NON-ANCHORED-OFFSET . ANCHORED-OFFSET)', where
  636.      NON-ANCHORED-OFFSET is the amount of offset given to
  637.      non-column-zero anchored comment-only lines, and ANCHORED-OFFSET
  638.      is the amount of offset to give column-zero anchored comment-only
  639.      lines.  Just an integer as value is equivalent to `(VAL . 0)'.
  640. `c-comment-start-regexp'
  641.      This buffer-local variable specifies how to recognize the start of
  642.      a comment.
  643. `c-hanging-comment-ender-p'
  644.      If this variable is `nil', `c-fill-paragraph' leaves the comment
  645.      terminator of a block comment on a line by itself.  The default
  646.      value is `t', which always puts the comment-end delimiter `*/' at
  647.      the end of the last line of the comment text.
  648. File: emacs,  Node: Fortran,  Next: Asm Mode,  Prev: C Mode,  Up: Programs
  649. Fortran Mode
  650. ============
  651.    Fortran mode provides special motion commands for Fortran statements
  652. and subprograms, and indentation commands that understand Fortran
  653. conventions of nesting, line numbers and continuation statements.
  654. Fortran mode has its own Auto Fill mode that breaks long lines into
  655. proper Fortran continuation lines.
  656.    Special commands for comments are provided because Fortran comments
  657. are unlike those of other languages.  Built-in abbrevs optionally save
  658. typing when you insert Fortran keywords.
  659.    Use `M-x fortran-mode' to switch to this major mode.  This command
  660. runs the hook `fortran-mode-hook' (*note Hooks::.).
  661. * Menu:
  662. * Motion: Fortran Motion.     Moving point by statements or subprograms.
  663. * Indent: Fortran Indent.     Indentation commands for Fortran.
  664. * Comments: Fortran Comments.     Inserting and aligning comments.
  665. * Autofill: Fortran Autofill.     Auto fill minor mode for Fortran.
  666. * Columns: Fortran Columns.     Measuring columns for valid Fortran.
  667. * Abbrev: Fortran Abbrev.     Built-in abbrevs for Fortran keywords.
  668. File: emacs,  Node: Fortran Motion,  Next: Fortran Indent,  Up: Fortran
  669. Motion Commands
  670. ---------------
  671.    Fortran mode provides special commands to move by subprograms
  672. (functions and subroutines) and by statements.  There is also a command
  673. to put the region around one subprogram, convenient for killing it or
  674. moving it.
  675. `C-M-a'
  676.      Move to beginning of subprogram
  677.      (`beginning-of-fortran-subprogram').
  678. `C-M-e'
  679.      Move to end of subprogram (`end-of-fortran-subprogram').
  680. `C-M-h'
  681.      Put point at beginning of subprogram and mark at end
  682.      (`mark-fortran-subprogram').
  683. `C-c C-n'
  684.      Move to beginning of current or next statement
  685.      (`fortran-next-statement').
  686. `C-c C-p'
  687.      Move to beginning of current or previous statement
  688.      (`fortran-previous-statement').
  689. File: emacs,  Node: Fortran Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
  690. Fortran Indentation
  691. -------------------
  692.    Special commands and features are needed for indenting Fortran code
  693. in order to make sure various syntactic entities (line numbers, comment
  694. line indicators and continuation line flags) appear in the columns that
  695. are required for standard Fortran.
  696. * Menu:
  697. * Commands: ForIndent Commands.  Commands for indenting Fortran.
  698. * Contline: ForIndent Cont.      How continuation lines indent.
  699. * Numbers:  ForIndent Num.       How line numbers auto-indent.
  700. * Conv:     ForIndent Conv.      Conventions you must obey to avoid trouble.
  701. * Vars:     ForIndent Vars.      Variables controlling Fortran indent style.
  702. File: emacs,  Node: ForIndent Commands,  Next: ForIndent Cont,  Up: Fortran Indent
  703. Fortran Indentation Commands
  704. ............................
  705. `TAB'
  706.      Indent the current line (`fortran-indent-line').
  707. `LFD'
  708.      Indent the current and start a new indented line
  709.      (`fortran-indent-new-line').
  710. `M-LFD'
  711.      Break the current line and set up a continuation line.
  712. `C-M-q'
  713.      Indent all the lines of the subprogram point is in
  714.      (`fortran-indent-subprogram').
  715.    Fortran mode redefines TAB to reindent the current line for Fortran
  716. (`fortran-indent-line').  This command indents Line numbers and
  717. continuation markers to their required columns, and independently
  718. indents the body of the statement based on its nesting in the program.
  719.    The key `LFD' runs the command `fortran-indent-new-line', which
  720. reindents the current line then makes and indents a new line.  This
  721. command is useful to reindent the closing statement of `do' loops and
  722. other blocks before starting a new line.
  723.    The key `C-M-q' runs `fortran-indent-subprogram', a command to
  724. reindent all the lines of the Fortran subprogram (function or
  725. subroutine) containing point.
  726.    The key `M-LFD' runs `fortran-split-line', which splits a line in
  727. the appropriate fashion for Fortran.  In a non-comment line, the second
  728. half becomes a continuation line and is indented accordingly.  In a
  729. comment line, both halves become separate comment lines.
  730. File: emacs,  Node: ForIndent Cont,  Next: ForIndent Num,  Prev: ForIndent Commands,  Up: Fortran Indent
  731. Continuation Lines
  732. ..................
  733.    Most modern Fortran compilers allow two ways of writing continuation
  734. lines.  If the first non-space character on a line is in column 5, then
  735. that line is a continuation of the previous line.  We call this "fixed
  736. format".  (In GNU Emacs we always count columns from 0.)  The variable
  737. `fortran-continuation-string' specifies what character to put on column
  738. 5.  A line that starts with a tab character followed by any digit
  739. except `0' is also a continuation line.  We call this style of
  740. continuation "tab format".
  741.    Fortran mode can make either style of continuation line, but you
  742. must specify which one you prefer.  The value of the variable
  743. `indent-tabs-mode' controls the choice: `nil' for fixed format, and
  744. non-`nil' for tab format.  You can tell which style is presently in
  745. effect by the presence or absence of the string `Tab' in the mode line.
  746.    If the text on a line starts with the conventional Fortran
  747. continuation marker `$', or if it begins with any non-whitespace
  748. character in column 5, Fortran mode treats it as a continuation line.
  749. When you indent a continuation line with TAB, it converts the line to
  750. the current continuation style.  When you split a Fortran statement
  751. with `M-LFD', the continuation marker on the newline is created
  752. according to the continuation style.
  753.    The setting of continuation style affects several other aspects of
  754. editing in Fortran mode.  In fixed format mode, the minimum column
  755. number for the body of a statement is 6.  Lines inside of Fortran
  756. blocks that are indented to larger column numbers always use only the
  757. space character for whitespace.  In tab format mode, the minimum column
  758. number for the statement body is 8, and the whitespace before column 8
  759. must always consist of one tab character.
  760.    When you enter Fortran mode for an existing file, it tries to deduce
  761. the proper continuation style automatically from the file contents.
  762. The first line that begins with either a tab character or six spaces
  763. determines the choice.  The variable `fortran-analyze-depth' specifies
  764. how many lines to consider (at the beginning of the file); if none of
  765. those lines indicates a style, then the variable
  766. `fortran-tab-mode-default' specifies the style.  If it is `nil', that
  767. specifies fixed format, and non-`nil' specifies tab format.
  768. File: emacs,  Node: ForIndent Num,  Next: ForIndent Conv,  Prev: ForIndent Cont,  Up: Fortran Indent
  769. Line Numbers
  770. ............
  771.    If a number is the first non-whitespace in the line, Fortran
  772. indentation assumes it is a line number and moves it to columns 0
  773. through 4.  (Columns always count from 0 in GNU Emacs.)
  774.    Line numbers of four digits or less are normally indented one space.
  775. The variable `fortran-line-number-indent' controls this; it specifies
  776. the maximum indentation a line number can have.  Line numbers are
  777. indented to right-justify them to end in column 4 unless that would
  778. require more than this maximum indentation.  The default value of the
  779. variable is 1.
  780.    Simply inserting a line number is enough to indent it according to
  781. these rules.  As each digit is inserted, the indentation is recomputed.
  782. To turn off this feature, set the variable
  783. `fortran-electric-line-number' to `nil'.  Then inserting line numbers
  784. is like inserting anything else.
  785. File: emacs,  Node: ForIndent Conv,  Next: ForIndent Vars,  Prev: ForIndent Num,  Up: Fortran Indent
  786. Syntactic Conventions
  787. .....................
  788.    Fortran mode assumes that you follow certain conventions that
  789. simplify the task of understanding a Fortran program well enough to
  790. indent it properly:
  791.    * Two nested `do' loops never share a `continue' statement.
  792.    * Fortran keywords such as `if', `else', `then', `do' and others are
  793.      written without embedded whitespace or line breaks.
  794.      Fortran compilers generally ignore whitespace outside of string
  795.      constants, but Fortran mode does not recognize these keywords if
  796.      they are not contiguous.  Constructs such as `else if' or `end do'
  797.      are acceptable, but the second word should be on the same line as
  798.      the first and not on a continuation line.
  799. If you fail to follow these conventions, the indentation commands may
  800. indent some lines unaesthetically.  However, a correct Fortran program
  801. retains its meaning when reindented even if the conventions are not
  802. followed.
  803. File: emacs,  Node: ForIndent Vars,  Prev: ForIndent Conv,  Up: Fortran Indent
  804. Variables for Fortran Indentation
  805. .................................
  806.    Several additional variables control how Fortran indentation works:
  807. `fortran-do-indent'
  808.      Extra indentation within each level of `do' statement (default 3).
  809. `fortran-if-indent'
  810.      Extra indentation within each level of `if' statement (default 3).
  811.      This value is also used for extra indentation within each level of
  812.      the Fortran 90 `where' statement.
  813. `fortran-structure-indent'
  814.      Extra indentation within each level of `structure', `union', or
  815.      `map' statements (default 3).
  816. `fortran-continuation-indent'
  817.      Extra indentation for bodies of continuation lines (default 5).
  818. `fortran-check-all-num-for-matching-do'
  819.      If this is `nil', indentation assumes that each `do' statement
  820.      ends on a `continue' statement.  Therefore, when computing
  821.      indentation for a statement other than `continue', it can save time
  822.      by not checking for a `do' statement ending there.  If this is
  823.      non-`nil', indenting any numbered statement must check for a `do'
  824.      that ends there.  The default is `nil'.
  825. `fortran-blink-matching-if'
  826.      If this is `t', indenting an `endif' statement moves the cursor
  827.      momentarily to the matching `if' statement to show where it is.
  828.      The default is `nil'.
  829. `fortran-minimum-statement-indent-fixed'
  830.      Minimum indentation for fortran statements when using fixed format
  831.      continuation line style.  Statement bodies are never indented less
  832.      than this much.  The default is 6.
  833. `fortran-minimum-statement-indent-tab'
  834.      Minimum indentation for fortran statements for tab format
  835.      continuation line style.  Statement bodies are never indented less
  836.      than this much.  The default is 8.
  837. File: emacs,  Node: Fortran Comments,  Next: Fortran Autofill,  Prev: Fortran Indent,  Up: Fortran
  838. Fortran Comments
  839. ----------------
  840.    The usual Emacs comment commands assume that a comment can follow a
  841. line of code.  In Fortran, the standard comment syntax requires an
  842. entire line to be just a comment.  Therefore, Fortran mode replaces the
  843. standard Emacs comment commands and defines some new variables.
  844.    Fortran mode can also handle a nonstandard comment syntax where
  845. comments start with `!' and can follow other text.  Because only some
  846. Fortran compilers accept this syntax, Fortran mode will not insert such
  847. comments unless you have said in advance to do so.  To do this, set the
  848. variable `comment-start' to `"!"' (*note Variables::.).
  849. `M-;'
  850.      Align comment or insert new comment (`fortran-comment-indent').
  851. `C-x ;'
  852.      Applies to nonstandard `!' comments only.
  853. `C-c ;'
  854.      Turn all lines of the region into comments, or (with argument)
  855.      turn them back into real code (`fortran-comment-region').
  856.    `M-;' in Fortran mode is redefined as the command
  857. `fortran-comment-indent'.  Like the usual `M-;' command, this
  858. recognizes any kind of existing comment and aligns its text
  859. appropriately; if there is no existing comment, a comment is inserted
  860. and aligned.  But inserting and aligning comments are not the same in
  861. Fortran mode as in other modes.
  862.    When a new comment must be inserted, if the current line is blank, a
  863. full-line comment is inserted.  On a non-blank line, a nonstandard `!'
  864. comment is inserted if you have said you want to use them.  Otherwise a
  865. full-line comment is inserted on a new line before the current line.
  866.    Nonstandard `!' comments are aligned like comments in other
  867. languages, but full-line comments are different.  In a standard
  868. full-line comment, the comment delimiter itself must always appear in
  869. column zero.  What can be aligned is the text within the comment.  You
  870. can choose from three styles of alignment by setting the variable
  871. `fortran-comment-indent-style' to one of these values:
  872. `fixed'
  873.      Align the text at a fixed column, which is the sum of
  874.      `fortran-comment-line-extra-indent' and the minimum statement
  875.      indentation.  This is the default.
  876.      The minimum statement indentation is
  877.      `fortran-minimum-statement-indent-fixed' for fixed format
  878.      continuation line style and `fortran-minimum-statement-indent-tab'
  879.      for tab format style.
  880. `relative'
  881.      Align the text as if it were a line of code, but with an additional
  882.      `fortran-comment-line-extra-indent' columns of indentation.
  883. `nil'
  884.      Don't move text in full-line columns automatically at all.
  885.    In addition, you can specify the character to be used to indent
  886. within full-line comments by setting the variable
  887. `fortran-comment-indent-char' to the single-character string you want
  888. to use.
  889.    Fortran mode introduces two variables `comment-line-start' and
  890. `comment-line-start-skip' which play for full-line comments the same
  891. roles played by `comment-start' and `comment-start-skip' for ordinary
  892. text-following comments.  Normally these are set properly by Fortran
  893. mode so you do not need to change them.
  894.    The normal Emacs comment command `C-x ;' has not been redefined.  If
  895. you use `!' comments, this command can be used with them.  Otherwise it
  896. is useless in Fortran mode.
  897.    The command `C-c ;' (`fortran-comment-region') turns all the lines
  898. of the region into comments by inserting the string `C$$$' at the front
  899. of each one.  With a numeric argument, it turns the region back into
  900. live code by deleting `C$$$' from the front of each line in it.  The
  901. string used for these comments can be controlled by setting the
  902. variable `fortran-comment-region'.  Note that here we have an example
  903. of a command and a variable with the same name; these two uses of the
  904. name never conflict because in Lisp and in Emacs it is always clear
  905. from the context which one is meant.
  906.